package com.mocai.merchant.spring.aspect;

import com.mocai.merchant.exception.PersistenceException;
import org.aspectj.lang.JoinPoint;

/**
 * 持久层异常处理切面
 */
public class PersistenceExceptionAspect extends AspectTemplate {

    /**
     * 将持久层抛出的所有异常，都包装为PersistenceException进行抛出
     *
     * @param joinPoint
     * @param ex
     * @see PersistenceException
     */
    @Override
    protected void afterThrowingAdvice(JoinPoint joinPoint, Throwable ex) {
        throw new PersistenceException(ex);
    }
}
